package casa.depesos.app.com.http.req;

import java.util.Map;

import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.SubOrderBean;
import casa.depesos.app.com.http.data.Fee;
import casa.depesos.app.com.http.parser.SubOrderParser;
import casa.depesos.app.com.utils.Constant;
import casa.depesos.app.com.utils.Utils;

public class SubOrderReq implements HttpReq<SubOrderBean> {

    long amount;
    Fee fee;
    String cardId, auto;

    public SubOrderReq(long amount, Fee fee, String cardId, String auto) {
        this.amount = amount;
        this.fee = fee;
        this.cardId = cardId;
        this.auto = auto;
    }

    @Override
    public void req(ReqCallback<SubOrderBean> callback) {//    /app/order/sendOrderRisk
        req("/app/transaction/sendTransactionRiskAssessment", new SubOrderParser(), callback);
    }

    @Override
    public Map getBody() {
        Map map = HttpReq.super.getBody();
        map.put("apsum", amount);
        map.put("mobiTok", Constant.getToken());
        map.put("reqnum", Constant.getApplyId());
        map.put("fkind", fee.type);
        map.put("fprop", fee.rate);
        map.put("pdays", fee.day);
        map.put("substage", fee.phase);
        map.put("applicationPhaseUtil", fee.unit);
        map.put("pnum", fee.id);
        map.put("crdef", cardId);
        map.put("rrpayrate", fee.backRate);
        map.put("deviceID", Utils.getDeviceId());
        map.put("automal", auto);
        return map;
    }
}
